Skip to content

Commit

Permalink
refactor(docs): Using java classes copied from main instead of conver…
Browse files Browse the repository at this point in the history
…ting them to kotlin.
  • Loading branch information
taikuukaits committed Nov 1, 2019
1 parent dc4fd4b commit 84fe96d
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 59 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* detect-configuration
*
* Copyright (c) 2019 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 com.synopsys.integration.detect.docs.copied;

import java.util.ArrayList;
import java.util.List;

//Copied from detect-configuration
public class HelpJsonData {
public final List<HelpJsonExitCode> exitCodes = new ArrayList<>();
public List<HelpJsonDetector> buildDetectors = new ArrayList<>();
public List<HelpJsonDetector> buildlessDetectors = new ArrayList<>();
public final List<HelpJsonOption> options = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* detect-configuration
*
* Copyright (c) 2019 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 com.synopsys.integration.detect.docs.copied;

import java.util.ArrayList;
import java.util.List;

//Copied from detect-configuration
public class HelpJsonDetector {
public String detectableName = "";
public String detectableDescriptiveName = "";
public String detectableGroup = "";
public String detectorType = "";
public String detectorName = "";
public String detectorDescriptiveName = "";
public int maxDepth = 0;
public boolean nestable = false;
public boolean nestInvisible = false;

public List<String> yieldsTo = new ArrayList<>();
public String fallbackTo = "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* detect-configuration
*
* Copyright (c) 2019 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 com.synopsys.integration.detect.docs.copied;

//Copied from detect-configuration
public class HelpJsonExitCode {
public String exitCodeKey = "";
public String exitCodeDescription = "";
public int exitCodeValue = 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* detect-configuration
*
* Copyright (c) 2019 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 com.synopsys.integration.detect.docs.copied;

import java.util.ArrayList;
import java.util.List;

//Copied from detect-configuration
public class HelpJsonOption {
public String propertyName = "";
public String propertyKey = "";
public String propertyType = "";
public String defaultValue = "";
public String addedInVersion = "";
public String category = "";
public String group = "";
public String superGroup = "";
public List<String> additionalGroups = new ArrayList<>();
public String description = "";
public String detailedDescription = "";
public boolean deprecated = false;
public String deprecatedDescription = "";
public String deprecatedFailInVersion = "";
public String deprecatedRemoveInVersion = "";
public boolean strictValues = false;
public boolean caseSensitiveValues = false;
public boolean hasAcceptableValues = false;
public boolean isCommaSeparatedList = false;
public List<String> acceptableValues = new ArrayList<>();

//This is added for use in the markdown, it does not actually exist on the object.
public String location = "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
package com.synopsys.integration.detect.docs

import com.google.gson.Gson
import com.synopsys.integration.detect.docs.copied.HelpJsonData
import com.synopsys.integration.detect.docs.copied.HelpJsonExitCode
import com.synopsys.integration.detect.docs.copied.HelpJsonOption
import freemarker.template.Configuration
import freemarker.template.Template
import org.apache.commons.io.FileUtils
Expand All @@ -32,7 +35,7 @@ import org.gradle.api.tasks.TaskAction
import java.io.File
import java.io.FileOutputStream

open class GenerateDocTask : DefaultTask() {
open class GenerateDocsTask : DefaultTask() {
@TaskAction
fun generateDocs() {
val file = File("synopsys-detect-${project.version}-help.json")
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions docs.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import com.synopsys.integration.detect.docs.GenerateDocTask
import com.synopsys.integration.detect.docs.GenerateDocsTask

task helpJson(type: JavaExec) {
dependsOn build
Expand All @@ -9,7 +9,7 @@ task helpJson(type: JavaExec) {
args = ['--helpjson']
}

task generateDocs(type: GenerateDocTask) {
task generateDocs(type: GenerateDocsTask) {
dependsOn helpJson
}

Expand Down

0 comments on commit 84fe96d

Please sign in to comment.