mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
build scripts redesign: support signing
This commit is contained in:
@@ -35,6 +35,7 @@ abstract class BuildContext {
|
||||
ProductProperties productProperties
|
||||
MacHostProperties macHostProperties
|
||||
BuildOptions options
|
||||
SignTool signTool
|
||||
|
||||
/**
|
||||
* Build number without product code (e.g. '162.500.10')
|
||||
@@ -70,13 +71,15 @@ abstract class BuildContext {
|
||||
|
||||
abstract JpsModule findModule(String name)
|
||||
|
||||
abstract void signExeFile(String path)
|
||||
|
||||
abstract void executeStep(String stepMessage, String stepId, Closure step)
|
||||
|
||||
public static BuildContext createContext(GantBuilder ant, JpsGantProjectBuilder projectBuilder, JpsProject project, JpsGlobal global,
|
||||
String communityHome, String projectHome, String buildOutputRoot, ProductProperties productProperties,
|
||||
BuildOptions options = new BuildOptions(), MacHostProperties macHostProperties = null) {
|
||||
BuildOptions options = new BuildOptions(), MacHostProperties macHostProperties = null, SignTool signTool = null) {
|
||||
return new BuildContextImpl(ant, projectBuilder, project, global, communityHome, projectHome, buildOutputRoot, productProperties,
|
||||
options, macHostProperties)
|
||||
options, macHostProperties, signTool)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* 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.jetbrains.intellij.build
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
interface SignTool {
|
||||
void signExeFile(String path, BuildContext context)
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.intellij.build.BuildOptions
|
||||
import org.jetbrains.intellij.build.BuildPaths
|
||||
import org.jetbrains.intellij.build.MacHostProperties
|
||||
import org.jetbrains.intellij.build.ProductProperties
|
||||
import org.jetbrains.intellij.build.SignTool
|
||||
import org.jetbrains.jps.gant.JpsGantProjectBuilder
|
||||
import org.jetbrains.jps.model.JpsGlobal
|
||||
import org.jetbrains.jps.model.JpsProject
|
||||
@@ -43,7 +44,7 @@ class BuildContextImpl extends BuildContext {
|
||||
|
||||
BuildContextImpl(GantBuilder ant, JpsGantProjectBuilder projectBuilder, JpsProject project, JpsGlobal global,
|
||||
String communityHome, String projectHome, String buildOutputRoot, ProductProperties productProperties,
|
||||
BuildOptions options = new BuildOptions(), MacHostProperties macHostProperties = null) {
|
||||
BuildOptions options, MacHostProperties macHostProperties, SignTool signTool) {
|
||||
this.projectBuilder = projectBuilder
|
||||
this.ant = ant
|
||||
this.project = project
|
||||
@@ -51,6 +52,7 @@ class BuildContextImpl extends BuildContext {
|
||||
this.productProperties = productProperties
|
||||
this.options = options
|
||||
this.macHostProperties = macHostProperties
|
||||
this.signTool = signTool
|
||||
underTeamCity = System.getProperty("teamcity.buildType.id") != null
|
||||
messages = new BuildMessagesImpl(projectBuilder, ant.project, underTeamCity)
|
||||
|
||||
@@ -136,6 +138,18 @@ class BuildContextImpl extends BuildContext {
|
||||
project.modules.find { it.name == name }
|
||||
}
|
||||
|
||||
@Override
|
||||
void signExeFile(String path) {
|
||||
if (signTool != null) {
|
||||
messages.progress("Signing $path")
|
||||
signTool.signExeFile(path, this)
|
||||
messages.info("Signing done")
|
||||
}
|
||||
else {
|
||||
messages.warning("Sign tool isn't defined, $path won't be signed")
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void executeStep(String stepMessage, String stepId, Closure step) {
|
||||
if (options.buildStepsToSkip.contains(stepId)) {
|
||||
|
||||
@@ -114,23 +114,7 @@ class WinExeInstallerBuilder {
|
||||
buildContext.messages.error("Windows installer wasn't created.")
|
||||
}
|
||||
|
||||
//todo[nik] improve, probably it would be better to automatically download jet-sign.jar or pass it via property
|
||||
def signJarPath = "${buildContext.paths.projectHome}/build/lib/jet-sign.jar"
|
||||
if (new File(signJarPath).exists()) {
|
||||
buildContext.messages.progress("Signing $installerPath")
|
||||
ant.taskdef(name: "jet-sign", classname: "jetbrains.sign.JetSignTask") {
|
||||
classpath(path: signJarPath)
|
||||
}
|
||||
ant."jet-sign"() {
|
||||
ant.fileset(dir: buildContext.paths.artifacts) {
|
||||
include(name: "${outFileName}.exe")
|
||||
}
|
||||
}
|
||||
buildContext.messages.info("Signing done")
|
||||
}
|
||||
else {
|
||||
buildContext.messages.warning("$signJarPath not found, installer won't be signed")
|
||||
}
|
||||
buildContext.signExeFile(installerPath)
|
||||
buildContext.notifyArtifactBuilt(installerPath)
|
||||
}
|
||||
|
||||
|
||||
@@ -122,13 +122,14 @@ class WindowsDistributionBuilder {
|
||||
|
||||
def communityHome = "$buildContext.paths.communityHome"
|
||||
String inputPath = "$communityHome/bin/WinLauncher/WinLauncher${arch.fileSuffix}.exe"
|
||||
def outputPath = "$winDistPath/bin/$exeFileName"
|
||||
buildContext.ant.java(classname: "com.pme.launcher.LauncherGeneratorMain", fork: "true", failonerror: "true") {
|
||||
sysproperty(key: "java.awt.headless", value: "true")
|
||||
arg(value: inputPath)
|
||||
arg(value: buildContext.findApplicationInfoInSources().absolutePath)
|
||||
arg(value: "$communityHome/native/WinLauncher/WinLauncher/resource.h")
|
||||
arg(value: launcherPropertiesPath)
|
||||
arg(value: "$winDistPath/bin/$exeFileName")
|
||||
arg(value: outputPath)
|
||||
classpath {
|
||||
pathelement(location: "$communityHome/build/lib/launcher-generator.jar")
|
||||
fileset(dir: "$communityHome/lib") {
|
||||
@@ -141,6 +142,7 @@ class WindowsDistributionBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
buildContext.signExeFile(outputPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user