Skip to content

Commit

Permalink
build - Add project version information (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo authored Sep 5, 2024
1 parent 3129d53 commit 539099f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extends:
AuthCertName: 'vscjava-esrprelease-auth'
AuthSignCertName: 'VSCJava-CodeSign'
FolderPath: server/build/libs
Pattern: plugin.jar,server.jar
Pattern: plugin-*.jar,server.jar
signConfigType: inlineSignParams
inlineOperation: |-
[
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ See [ARCHITECTURE.md](./ARCHITECTURE.md)

## Launch the Build Server for Gradle
### Specify the Plugin Location
The main class of the build server is `com.microsoft.java.bs.core.Launcher`. When you launch the server, you need to specify the location of the Gradle plugin via the system property `plugin.dir`. By default, you will find the plugin jar at `server/build/libs/plugins/plugin.jar` after building the project.
The main class of the build server is `com.microsoft.java.bs.core.Launcher`. When you launch the server, you need to specify the location of the Gradle plugin via the system property `plugin.dir`. By default, you will find the plugin jar at `server/build/libs/plugins/plugin-${version}.jar` after building the project.
### Preferences

A [Preferences](./server/src/main/java/com/microsoft/java/bs/core/internal/model/Preferences.java) object can be put into the data field of the `build/initialize` request for customization. Please check the comments in the code for the meaning of each preference.
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=0.4.0-SNAPSHOT
5 changes: 4 additions & 1 deletion plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jar {
it.isDirectory() ? it : zipTree(it)
}
}
archiveFileName = "plugin-${version}.jar"
}

test {
Expand All @@ -39,6 +40,8 @@ test {

task copyJar(type: Copy) {
dependsOn(':plugin:jar')
from "build/libs/plugin.jar"
from ("build/libs") {
include "*.jar"
}
into "../server/build/libs/plugins"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ private PluginHelper() {}
* Returns the init script file.
*/
public static File getInitScript() throws IOException {
File pluginJarFile = Paths.get(System.getProperty("user.dir"),
"build", "libs", "plugin.jar").toFile();
File pluginFolder = Paths.get(System.getProperty("user.dir"),
"build", "libs").toFile();
File pluginJarFile = pluginFolder.listFiles()[0];
String pluginJarUnixPath = pluginJarFile.getAbsolutePath().replace("\\", "/");
String initScriptContent =
"initscript {\n"
Expand Down
22 changes: 13 additions & 9 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ application {
}

jar {
archiveFileName = "server.jar"
metaInf {
from 'src/main/resources/NOTICE.txt'
}
manifest {
attributes 'Implementation-Version': version
}
}

test {
Expand All @@ -40,15 +44,15 @@ task generateInitScript() {
def initScript = file("$buildDir/libs/plugins/init.gradle")
initScript.parentFile.mkdirs()
initScript.write """
initscript {
dependencies {
classpath files('plugin.jar')
}
}
allprojects {
apply plugin: com.microsoft.java.bs.gradle.plugin.GradleBuildServerPlugin
}
"""
initscript {
dependencies {
classpath files('plugin-${version}.jar')
}
}
allprojects {
apply plugin: com.microsoft.java.bs.gradle.plugin.GradleBuildServerPlugin
}
"""
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class Constants {
/**
* The version of the build server.
*/
public static final String SERVER_VERSION = "0.3.0";
public static final String SERVER_VERSION = Constants.class.getPackage()
.getImplementationVersion();
/**
* The version of the BSP specification.
*/
Expand Down

0 comments on commit 539099f

Please sign in to comment.