Relocate projects to spring-boot-project

Move projects to better reflect the way that Spring Boot is released.

The following projects are under `spring-boot-project`:

  - `spring-boot`
  - `spring-boot-autoconfigure`
  - `spring-boot-tools`
  - `spring-boot-starters`
  - `spring-boot-actuator`
  - `spring-boot-actuator-autoconfigure`
  - `spring-boot-test`
  - `spring-boot-test-autoconfigure`
  - `spring-boot-devtools`
  - `spring-boot-cli`
  - `spring-boot-docs`

See gh-9316
This commit is contained in:
Phillip Webb
2017-09-19 14:29:46 -07:00
parent 0419d42b7c
commit 0ba4830b4f
4023 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.ant;
import java.io.File;
import java.io.IOException;
import java.util.jar.JarFile;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.springframework.boot.loader.tools.MainClassFinder;
import org.springframework.util.StringUtils;
/**
* Ant task to find a main class.
*
* @author Matt Benson
* @since 1.3.0
*/
public class FindMainClass extends Task {
private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication";
private String mainClass;
private File classesRoot;
private String property;
public FindMainClass(Project project) {
setProject(project);
}
@Override
public void execute() throws BuildException {
String mainClass = this.mainClass;
if (!StringUtils.hasText(mainClass)) {
mainClass = findMainClass();
if (!StringUtils.hasText(mainClass)) {
throw new BuildException(
"Could not determine main class given @classesRoot "
+ this.classesRoot);
}
}
handle(mainClass);
}
private String findMainClass() {
if (this.classesRoot == null) {
throw new BuildException(
"one of @mainClass or @classesRoot must be specified");
}
if (!this.classesRoot.exists()) {
throw new BuildException(
"@classesRoot " + this.classesRoot + " does not exist");
}
try {
if (this.classesRoot.isDirectory()) {
return MainClassFinder.findSingleMainClass(this.classesRoot,
SPRING_BOOT_APPLICATION_CLASS_NAME);
}
return MainClassFinder.findSingleMainClass(new JarFile(this.classesRoot), "/",
SPRING_BOOT_APPLICATION_CLASS_NAME);
}
catch (IOException ex) {
throw new BuildException(ex);
}
}
private void handle(String mainClass) {
if (StringUtils.hasText(this.property)) {
getProject().setProperty(this.property, mainClass);
}
else {
log("Found main class " + mainClass);
}
}
/**
* Set the main class, which will cause the search to be bypassed.
* @param mainClass the main class name
*/
public void setMainClass(String mainClass) {
this.mainClass = mainClass;
}
/**
* Set the root location of classes to be searched.
* @param classesRoot the root location
*/
public void setClassesRoot(File classesRoot) {
this.classesRoot = classesRoot;
}
/**
* Set the ANT property to set (if left unset, result will be printed to the log).
* @param property the ANT property to set
*/
public void setProperty(String property) {
this.property = property;
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.ant;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.springframework.util.StringUtils;
/**
* Quiet task that establishes a reference to its loader.
*
* @author Matt Benson
* @since 1.3.0
*/
public class ShareAntlibLoader extends Task {
private String refid;
public ShareAntlibLoader(Project project) {
super();
setProject(project);
}
@Override
public void execute() throws BuildException {
if (!StringUtils.hasText(this.refid)) {
throw new BuildException("@refid has no text");
}
getProject().addReference(this.refid, getClass().getClassLoader());
}
public void setRefid(String refid) {
this.refid = refid;
}
}

View File

@@ -0,0 +1,83 @@
<?xml version="1.0"?>
<antlib>
<taskdef name="findmainclass" classname="org.springframework.boot.ant.FindMainClass" />
<!-- unadvertised taskdef to help pull antlib resources from within the antlib.xml file -->
<taskdef name="spring-boot-antlib-share-antlib-loader" classname="org.springframework.boot.ant.ShareAntlibLoader" />
<macrodef name="exejar" description="Create a spring-boot executable jar">
<attribute name="destfile" />
<attribute name="classes" />
<attribute name="start-class" default="" />
<element name="resources" optional="true"
description="includes resource collections specifying additional Java resources" />
<element name="lib" optional="true"
description="includes resource collections containing (jar) dependencies" />
<sequential>
<local name="start-class" />
<findmainclass
xmlns="antlib:org.springframework.boot.ant"
property="start-class"
mainclass="@{start-class}"
classesroot="@{classes}" />
<echo>Using start class ${start-class}</echo>
<spring-boot-antlib-share-antlib-loader
xmlns="antlib:org.springframework.boot.ant"
refid="spring.boot.antlib.loader" />
<local name="spring-boot.version" />
<loadproperties prefix="spring-boot">
<javaresource
name="META-INF/maven/org.springframework.boot/spring-boot-antlib/pom.properties"
loaderref="spring.boot.antlib.loader" />
<filterchain>
<linecontainsregexp>
<regexp pattern="^version=" />
</linecontainsregexp>
</filterchain>
</loadproperties>
<local name="destdir" />
<dirname file="@{destfile}" property="destdir" />
<echo>Using destination directory ${destdir}</echo>
<mkdir dir="${destdir}/dependency" />
<echo>Extracting spring-boot-loader to ${destdir}/dependency</echo>
<copy todir="${destdir}/dependency">
<javaresource name="META-INF/loader/spring-boot-loader.jar"
loaderref="spring.boot.antlib.loader" />
<flattenmapper />
</copy>
<echo>Embedding spring-boot-loader v${spring-boot.version}...</echo>
<jar destfile="@{destfile}" compress="false">
<mappedresources>
<fileset dir="@{classes}"/>
<globmapper from="*" to="BOOT-INF/classes/*" />
</mappedresources>
<resources />
<mappedresources>
<lib />
<globmapper from="*" to="BOOT-INF/lib/*" />
</mappedresources>
<zipfileset src="${destdir}/dependency/spring-boot-loader.jar" />
<manifest>
<attribute name="Main-Class"
value="org.springframework.boot.loader.JarLauncher" />
<attribute name="Start-Class" value="${start-class}" />
<attribute name="Spring-Boot-Classes" value="BOOT-INF/classes/" />
<attribute name="Spring-Boot-Lib" value="BOOT-INF/lib/" />
</manifest>
</jar>
</sequential>
</macrodef>
</antlib>