Code Monkey home page Code Monkey logo

Comments (9)

dolauli avatar dolauli commented on August 11, 2024

p2

from autorest.powershell.

dolauli avatar dolauli commented on August 11, 2024

[11/11 11:21 AM] Xiaogang Ding

Hi Garrett, I notice there is a configuration called "license-header", which is used to add license header for source code generated. So I add something like "license-header: MICROSOFT_MIT_NO_VERSION" in the configuration, but it does not work. Is this function broke in autorest v3?

[11/12 12:13 AM] Garrett Serack
V2 Generators got that from the autorest.common library -- it's on my list to add that to autorest-core in v3 so that the license is available in the configuration

from autorest.powershell.

dolauli avatar dolauli commented on August 11, 2024

This should be implemented in autorest.core.

from autorest.powershell.

dolauli avatar dolauli commented on August 11, 2024

@fearthecowboy Please fix it as your earliest convenience since it blocks us from releasing to the public

from autorest.powershell.

fearthecowboy avatar fearthecowboy commented on August 11, 2024

I have added the code to autorest-core to support header text values

To use this version:
Ensure that you're on @autorest/autorest 3.0.6141 or greater:
npm install -g @autorest/autorest

and then do a --reset and get the specific autorest-core package version 3.0.6168:
autorest-beta --version:3.0.6168

then you can ask for the header-text configuration value (so when --license-header is specified, it will return the appropriate text

from autorest.powershell.

dolauli avatar dolauli commented on August 11, 2024

@fearthecowboy
It still does not work. BTW, the latest core version seems to be 3.0.6158 instead of 3.0.6168. And the configuration I specify in my readme.md is license-header: MICROSOFT_MIT_NO_VERSION

from autorest.powershell.

fearthecowboy avatar fearthecowboy commented on August 11, 2024

Ensure that you're on @autorest/autorest 3.0.6141 or greater:


👀 npm install -g @autorest/autorest

(which as of this moment, will install 3.0.6146)


the lastest version of the autorest-beta package has updates that are required in order to access pre-release versions of autorest-core.


The latest PRERELEASE version (ie, not pushed to NPM) is downloaded from https://github.com/Azure/autorest/releases in order to allow for significant regression testing before publishing.

from my sample generator

 // example: do something here.
    let text = "A source file\n";

    const headerText = await session.getValue("header-text", "NO HEADER TEXT?");

    text = text + headerText;

and when you get the value for header-text it will be:

Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See License.txt in the project root for license information.
Code generated by Microsoft (R) AutoRest Code Generator.
Changes may cause incorrect behavior and will be lost if the code is regenerated.

As you can see, it's in the output:
image

from autorest.powershell.

dolauli avatar dolauli commented on August 11, 2024

My bad. I mixed up the autorest and autorest.core version. I will have a try in the autorest.powershell generator. BTW, considering to add license header is a common requirement for all generators, can we implement it in a common plugin instead that each generator will have to write the license header by itself. @fearthecowboy

from autorest.powershell.

fearthecowboy avatar fearthecowboy commented on August 11, 2024

Given that each language has a different comment style, that is virtually impossible.

from autorest.powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.